package Controller;

import Model.*;

public class ForestOwnerCtr {

    //Properties
    private ForestCollection forestCollection;
    private OwnerCollection ownerCollection;

    //Constructor
    public ForestOwnerCtr(ForestCollection forestCollection, OwnerCollection ownerCollection) {
        forestCollection = forestCollection.getInstance();
        ownerCollection = ownerCollection.getInstance();
    }

    //Add an owner
    public void addOwner(String ownerName, String address, int phoneNumber){
        Owner o = new Owner(ownerName, address, phoneNumber);
        ownerCollection.addOwner(o);
    }

    //Add a forest
    public void addForest(String name, String location, double squareMetre, String natureOfTrees, double price){
        Forest f = new Forest(name, location, squareMetre, natureOfTrees, price);
        forestCollection.addForest(f);
    }

    //Owner search
    public Owner ownerSearch(String name){
        if (ownerCollection.findOwner(name) == null){
            return null;
        }
        else { return ownerCollection.findOwner(name); }
    }

    //Forest search
    public Forest forestSearch(String name){
        if (forestCollection.findForest(name) == null){
            return null;
        }
        else { return forestCollection.findForest(name); }
    }

    //Add forest to an owner
    public void addForestOwner(Owner ownerName, Forest forestName){

    forestCollection.addForest(forestName, ownerName);



    }
}

